﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace AnimalWars2
{

    public abstract class Entity
    {
        public Vector2 m_Pos = new Vector2(0.0f, 0.0f);
        public Texture2D m_Texture;
        public float m_Scale = 1.0f;
        public float m_Depth = 0.5f;
        public Color m_oColor = Color.White;
        public Vector2 m_Size;

        public Game m_Game;

        public Entity(Game GameRef, Vector2 Pos, Texture2D Tex)
        {
            m_Pos = Pos;
            m_Game = GameRef;
            m_Texture = Tex;
            m_Size = new Vector2(m_Texture.Width, m_Texture.Height);
        }

        public abstract void Update(GameTime gameTime);

        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(
                m_Texture,
                m_Game.m_Camera.TransformPos(m_Pos), // posicao relativa a camera
                null,
                m_oColor,
                0.0f,
                m_Size * 0.5f, // origem no centro
                m_Game.m_Camera.TransformScale(m_Pos, new Vector2(m_Scale, m_Scale)), // tamanho relativo a camera e ao m_Scale
                SpriteEffects.None,
                m_Depth
            );
        }
    }
}
